<?php
function getVisionCmsNews($url = 'http://dev.dimenze.net/libs/rss/rss.articles.php', $limit = 4)
{
 if (@ $xml = simplexml_load_file($url))
    {
        $counter = 0;
        $out = '<div>';
        foreach ($xml->channel->item as $item)
        {   
            
            if ($counter == $limit)
                break;
            $out .= '<p><img src="../libs/icons/newspaper.png" alt="News" /> <strong><a href="'.$item->link.'">'.$item->title.'</a></strong> <br /> '.$item->description.'</p>';
            $counter++;
        }
        $out .= '</div>';
    }
    else
    {
        $out = 'Požadovanou url nelze načíst ( <em>' . $url . '</em> )'; 
    }
    
    return $out;
}
?>
<h1><?php echo Lang::getBackGlobal('overview'); ?></h1>
<div id="rightnow">
<p class="msg info"><img src="../libs/icons/rss.png" alt="RSS" /> <?php echo Lang::getBackGlobal('news_vision'); ?></p>
<div id="news">
<?php echo getVisionCmsNews(); ?>

</div>
<br />
<div id="version">
<p class="msg info">
<?php
@ $xml = simplexml_load_file("http://dev.dimenze.net/version.xml");
if($xml){
	echo Lang::getBackGlobal('version_available') . ' <span class="help" title="'.Lang::getBackGlobal('version_stable_desc').'">'.Lang::getBackGlobal('version_stable').'</span> verze : <strong style="color: green;">'.$xml->stable.'</strong><br />'.Lang::getBackGlobal('version_available').' <span class="help" title="'.Lang::getBackGlobal('version_unstable_desc').'">'.Lang::getBackGlobal('version_unstable').'</span> verze : <strong style="color: red;">'.$xml->unstable.'</strong><br />'.Lang::getBackGlobal('version_your').' : '. VERSION;
}else{
	echo '<strong>Nelze načíst XML soubor s informacemi o verzích !</strong>';
}

?>
</p>
<?php

if(version_compare(VERSION, $xml->stable, "<")){
	echo "<p class=\"msg error\">".Lang::getBackGlobal('version_old')."</p>";
}elseif(version_compare(VERSION, $xml->stable, "=")){
	echo "<p class=\"msg done\">".Lang::getBackGlobal('version_good')."</p>";
}

?>
</div>
</div>
<br />
<div id="infowrap">
<div id="infobox" style="width: 100%" >
                    <p class="msg info"><img src="../libs/icons/folder_table.png" alt="Articles" /> <?php echo Lang::getBackGlobal('last_articles'); ?></p>
                    <table width="100%">
						<thead>
							<tr>
								<th><?php echo Lang::getBack('com_content', 'title'); ?></th>
                            	<th><?php echo Lang::getBack('com_content', 'author'); ?></th>
                                <th><?php echo Lang::getBack('com_content', 'category'); ?></th>
                                <th><?php echo Lang::getBack('com_content', 'comments'); ?></th>
                                <th><?php echo Lang::getBackGlobal('action'); ?></th>
                            </tr>
						</thead>
						<tbody>
						<?php
						require 'modules/mod_last_articles/mod_last_articles.php';
						?>
						</tbody>
					</table>
                  </div>
                  <div style="clear: both;"></div>
                  <div id="infobox" style="width: 100%">
                    <p class="msg info"><img src="../libs/icons/folder_lightbulb.png" alt="Comments" /> <?php echo Lang::getBackGlobal('last_comment'); ?></p>
                    <table width="100%">
						<thead>
							<tr>
                            	<th><?php echo Lang::getBack('com_comment', 'user'); ?></th>
                                <th><?php echo Lang::getBack('com_comment', 'text'); ?></th>
                            </tr>
						</thead>
						<tbody>
							<?php
							require 'modules/mod_last_comments/mod_last_comments.php';
							?>
						</tbody>
					</table>            
                  </div>
                  <div style="clear: both;"></div>
                  <div id="infobox" style="width: 100%">
                    <p class="msg info"><img src="../libs/icons/folder_user.png" alt="Users" /> <?php echo Lang::getBackGlobal('new_users'); ?></p>
                    <table width="100%">
						<thead>
							<tr>
                            	<th><?php echo Lang::getBack('com_user', 'username'); ?></th>
                                <th><?php echo Lang::getBack('com_user', 'birthday'); ?></th>
                                <th><?php echo Lang::getBack('com_user', 'email'); ?></th>
                                <th><?php echo Lang::getBack('com_user', 'gender'); ?></th>
                            </tr>
						</thead>
						<tbody>
							<?php
							require 'modules/mod_last_users/mod_last_users.php';
							?>
						</tbody>
					</table>                 
                  </div>
                  <div style="clear: both;"></div>
                  <div id="infobox" style="width: 100%">
                    <p class="msg info"><img src="../libs/icons/folder_page.png" alt="Pages" /> <?php echo Lang::getBackGlobal('last_pages'); ?></p> 
                    <table width="100%">
						<thead>
							<tr>
                            	<th><?php echo Lang::getBack('com_custom', 'title'); ?></th>
                                <th><?php echo Lang::getBack('com_custom', 'permissions'); ?></th>
                                <th><?php echo Lang::getBackGlobal('action'); ?></th>
                            </tr>
						</thead>
						<tbody>
							<?php
							require 'modules/mod_last_pages/mod_last_pages.php';
							?>
						</tbody>
					</table>
                  </div>
</div>